package team.wuyou.util.HttpSessionUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class UserSessionUtil {

    public static String getCurrentUserName(HttpServletRequest request) {
        HttpSession session = request.getSession(false); // 如果没有会话则返回null
        return (session != null) ? (String) session.getAttribute("username") : null;
    }
}